package com.wopinla.service.impl;
import com.wopinla.pojo.*;
import com.wopinla.dao.*;
import com.wopinla.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service   //添加注解
public class goodsServiceImpl implements goodsService
{
    @Autowired
    private goodsDao goodsDao;   //红线不要紧

    @Override
    public List<goods> searchGoodsByMap(Map<String,Object> map)
    {
        System.out.println("searchGoodsByMap");
        return goodsDao.searchGoodsByMap(map);
    }
    @Override
    public  List<goods> screeningGoodsByMap(Map<String,Object> map)
    {
        System.out.println("screeningGoodsByMap");
        return goodsDao.screeningGoodsByMap(map);
    }

    @Override
    public goods goodsdetailsById(Integer sid)
    {
        System.out.println("goodsdetailsById");
        return goodsDao.goodsdetailsById(sid);
    }

    @Override
    public int addgoods(Map<String,Object> map)
    {
        gstate state = new gstate();
        state.setSale("no");
        state.setActivity("no");
        state.setState("no");
        state.setStock("no");
        int flag=goodsDao.addgoods(map)&goodsDao.addgstate(state);
        return flag;
    }
    @Override
    public int removegoods(int cid)
    {
        return goodsDao.removegoods(cid)&goodsDao.removegstate(cid);
    }

    @Override
    public int shelves(Integer sid)
    {
        return goodsDao.shelves(sid);
    }
    @Override
    public int undercarriage(Integer sid)
    {
        return goodsDao.undercarriage(sid);
    }
    @Override
    public int updategoods(Map<String,Object> map)
    {
        return goodsDao.updategoods(map);
    }
    @Override
    public int updategoodstate(Map<String,Object> map){return goodsDao.updategoodstate(map);}
    @Override
    public List<goods> shelvesgoods(Integer eid,Integer sid){return goodsDao.shelvesgoods(eid,sid);}
    @Override
    public List<goods> goods(Integer eid,Integer sid){return goodsDao.goods(eid,sid);}
    @Override
    public List<goods> good(Integer eid,Integer sid){return goodsDao.good(eid,sid);}
}
